package grafos;


import edu.uci.ics.jung.algorithms.layout.Layout;
import edu.uci.ics.jung.algorithms.layout.StaticLayout;
import edu.uci.ics.jung.visualization.VisualizationViewer;
import edu.uci.ics.jung.visualization.control.EditingModalGraphMouse;
import edu.uci.ics.jung.visualization.decorators.ToStringLabeller;
import java.awt.*;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;

/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
/**
 *
 * @author ma028420
 */
class Painel extends JPanel {

    JScrollPane scrollPane = new JScrollPane();
    JTextField textFild = new JTextField();
    JPanel painel = new JPanel();

    public Painel() {
    }

    public void painel() {

        Tela sgv = new Tela();
        // Layout<V, E>, VisualizationViewer<V,E>
        Layout<Integer, String> layout = new StaticLayout(sgv.g);
        layout.setSize(new Dimension(300, 300));
        VisualizationViewer<Integer, String> vv = new VisualizationViewer<Integer, String>(layout);
        vv.setPreferredSize(new Dimension(350, 350));
        vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
        vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());
        EditingModalGraphMouse gm = new EditingModalGraphMouse(vv.getRenderContext(), sgv.vertexFactory, sgv.edgeFactory);
        vv.setGraphMouse(gm);
        vv.setBackground(Color.white);
        vv.setEnabled(true);
        vv.setSize(600,400);
        vv.setMinimumSize(new Dimension(500, 350));
        this.setVisible(true);
        this.setSize(600, 400);
        this.setEnabled(true);
        this.setLayout(new FlowLayout());
        painel.setVisible(true);
        painel.setSize(600, 400);
        painel.setEnabled(true);
        painel.setLayout(new FlowLayout());
        JPanel pn = new JPanel();
        pn.add(vv);
        scrollPane = new JScrollPane(pn);
//                scrollPane.add(vv);
//                scrollPane.setSize(600,400);
        textFild.setColumns(40);
        textFild.setText("Digite aqui os dados no formato xx,xx;");
        this.add(textFild);
        this.add(scrollPane);
        this.add(painel);

        
    }
    
}
